<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var str1 = 'abc___ABC___1234567890'
    var reg1 = /\w/ // 匹配字母数字下划线
    console.log(reg1.test(str1))

    var str2 = 'abc___ABC___1234567890'
    var reg2 = /\W/ // 匹配非字母数字下划线
    console.log(reg2.test(str2))

    var str3 = 'abc___ABC___'
    var reg3 = /\d/ // 匹配数字
    console.log(reg3.test(str3))

    var str4 = 'abc___ABC___'
    var reg4 = /\D/ // 匹配非数字
    console.log(reg4.test(str4))

    var str5 = '     '
    var reg5 = /\s/ // 匹配空白字符
    console.log(reg5.test(str5))

    var str6 = '     '
    var reg6 = /\S/ // 匹配非空白字符
    console.log(reg6.test(str6))

    var str7 = 'abc___ \n ABC___'
    console.log(str7);
    var reg7 = /\n/ //  匹配换行符
    console.log(reg7.test(str7))
  </script>    
</body>
</html>